﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PROFIP.Persistence.DTO.Scales;
using PROFIP.Utils;

namespace PROFIP
{
    public partial class AGFForm : ScaleForm
    {
        public AGFForm(MainForm mainForm, AGFDTO dto, int avaliationSheetIndex)
            : base(mainForm, dto, avaliationSheetIndex)
        {
            InitializeComponent();
            if (dto == null) return;

            Val91_100.Checked = dto.Val91_100;
            Val81_90.Checked = dto.Val81_90;
            Val71_80.Checked = dto.Val71_80;
            Val61_70.Checked = dto.Val61_70;
            Val51_60.Checked = dto.Val51_60;
            Val41_50.Checked = dto.Val41_50;
            Val31_40.Checked = dto.Val31_40;
            Val21_30.Checked = dto.Val21_30;
            Val11_20.Checked = dto.Val11_20;
            Val1_10.Checked = dto.Val1_10;
            Val0.Checked = dto.Val0;
            Application.DoEvents();
        }

        private void onClose(object sender, FormClosingEventArgs e)
        {
            AGFDTO dto = new AGFDTO();
            dto.Val91_100 = Val91_100.Checked;
            dto.Val81_90 = Val81_90.Checked;
            dto.Val71_80 = Val71_80.Checked;
            dto.Val61_70 = Val61_70.Checked;
            dto.Val51_60 = Val51_60.Checked;
            dto.Val41_50 = Val41_50.Checked;
            dto.Val31_40 = Val31_40.Checked;
            dto.Val21_30 = Val21_30.Checked;
            dto.Val11_20 = Val11_20.Checked;
            dto.Val1_10 = Val1_10.Checked;
            dto.Val0 = Val0.Checked;

            base.mainForm.updateAGF(dto, base.avaliationSheetIndex);
        }

        public String getScore()
        {
            if (Val0.Checked) return "0";
            if (Val1_10.Checked) return "1-10";
            if (Val11_20.Checked) return "11-20";
            if (Val21_30.Checked) return "21-30";
            if (Val31_40.Checked) return "31-40";
            if (Val41_50.Checked) return "41-50";
            if (Val51_60.Checked) return "51-60";
            if (Val61_70.Checked) return "61-70";
            if (Val71_80.Checked) return "71-80";
            if (Val81_90.Checked) return "81-90";
            if (Val91_100.Checked) return "91-100";
            return "";
        }
    }
}
